<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%@ include file="../common/include/header.jsp" %>

<%@ page import="java.util.*,util.*" %>

<div>
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr>
		<td style="vertical-align: top;width: 180px;background-color:  #fdb73a;">
			
<!-- Left Menu Including -->

<%@ include file="../common/include/leftmenu.jsp" %>

		</td>
		
		<td style="text-align: center;width: 800px;background: #ffffff; vertical-align: top;">
<!-- board view part -->
		<div id="freeMain" style="width: 800px;vertical-align: top;">

<table style="width: 800px;height: 500px;" border="0" cellpadding="0" cellspacing="0">

		<tr><td colspan="2" style="height: 150px;"><img src="<%=imagePath %>japan_02.jpg" border="0"/></td>			
			<td rowspan="3" style="background-image: url('<%=imagePath %>japan_01.jpg');width:200px;"></td></tr>

	<tr><td style="width: 300px;height: 170px;vertical-align: top;">
			<table style="width: 290px;">
				<tr><td style="height: 30px;width: 260px;">
				<a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','일본에서 살아남기');">
				<img src="<%=imagePath %>japan_03.jpg" border="0"/></a></td>
					<td style="width: 30px;"><a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','일본에서 살아남기');">
					<img src="<%=imagePath %>icon_more.jpg" border="0"></a></td></tr>
			</table>
			<table style="border: 1px dotted #dddddd;width: 290px;">
				<tbody id="board"></tbody>
			</table></td>
			
		<td style="width: 300px;height: 170px;vertical-align: top;">
			<table style="width: 290px;">
				<tr><td style="height: 30px;width: 260px;">
				<a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','일본생활 필수정보');">
				<img src="<%=imagePath %>japan_04.jpg" border="0"/></a></td>
					<td style="width: 30px;"><a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','일본생활 필수정보');">
					<img src="<%=imagePath %>icon_more.jpg" border="0"></a></td></tr>
			</table>
			<table style="border: 1px dotted #dddddd;width: 290px;">
				<tbody id="board"></tbody>
			</table>
		</td>
		</tr>

	<tr><td style="width: 300px;height: 170px;vertical-align: top;padding-top: 10px;">
			<table style="width: 290px;">
				<tr><td style="height: 30px;width: 260px;">
				<a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','에피소드 및 경험담');">
				<img src="<%=imagePath %>japan_05.jpg" border="0"/></a></td>
					<td style="width: 30px;"><a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','에피소드 및 경험담');">
					<img src="<%=imagePath %>icon_more.jpg" border="0"></a></td></tr>
			</table>
			<table style="border: 1px dotted #dddddd;width: 290px;">
				<tbody id="board"></tbody>
			</table></td>
			
	<td style="width: 300px;height: 170px;vertical-align: top;padding-top: 10px;">
			<table style="width: 290px;">
				<tr><td style="height: 30px;width: 260px;">
				<a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','아나바다 게시판');">
				<img src="<%=imagePath %>japan_06.jpg" border="0"/></a></td>
					<td style="width: 30px;"><a href="javascript:getBoard('freeboard.do?method=getList&cono=2&fbname=','아나바다 게시판');">
					<img src="<%=imagePath %>icon_more.jpg" border="0"></a></td></tr>
			</table>
			<table style="border: 1px dotted #dddddd;width: 290px;">
				<tbody id="board"></tbody>
			</table>
		</td></tr>

</table>

		</div>
		
		</td>		
	</tr>
</table>
</div>

<script type="text/javascript">
<!--
	window.attachEvent("onload",callBoards);
	
	var xmlHttp;
	
	function callBoards(){
		var url = "<%=path%>/board/menuajaxaction.do?method=freemain";
		createXMLHttpRequest();
	    xmlHttp.onreadystatechange = handleStateChange;
	    xmlHttp.open("GET", url, true);
	    xmlHttp.send(null);
		
	}
		function createXMLHttpRequest() {
	    if (window.ActiveXObject) {
	        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } 
	    else if (window.XMLHttpRequest) {
	        xmlHttp = new XMLHttpRequest();
	    }
	}
	
	function handleStateChange() {
	    if(xmlHttp.readyState == 4) {
	    	if(xmlHttp.status == 200){
	    		parseResponse();	       
			}	           
	    }
	}
	
	function parseResponse(){

		var xmlDoc = xmlHttp.responseXML;

		var datas = xmlDoc.getElementsByTagName('freeboard');

		
		for(var j=0;j<datas.length;j++){
			var frees = datas[j].getElementsByTagName('free');
			var fTbody = board[j];
			for(var i=0;i<frees.length;i++){
				var no = frees[i].getElementsByTagName('fbno')[0].firstChild.nodeValue;
				var cono = frees[i].getElementsByTagName('cono')[0].firstChild.nodeValue;
				var title = frees[i].getElementsByTagName('fbtitle')[0].firstChild.nodeValue;
				var date = frees[i].getElementsByTagName('fbdate')[0].firstChild.nodeValue;
				var fbname = frees[i].getElementsByTagName('fbname')[0].firstChild.nodeValue;
				var url = "freeboard.do?method=detailView&cono="+cono+"&fbno="+no+"&fbname="+escape(encodeURIComponent(fbname));
				fTbody.appendChild(createCell(no,title,date,url));
			}
		}
		
		xmlHttp = null;
	}
	
	function createCell(no,title,date,url){
		var cell = document.createElement('tr');
		
		var _iconImage = document.createElement('td');
		_img = document.createElement('img');
		_img.src = "<%=imagePath %>icon_topmenu.jpg";
		_iconImage.appendChild(_img);
		
		var _title = document.createElement('td');
		
		var _link = document.createElement('a');
		_link.appendChild(document.createTextNode(title));
		_link.href = "<%=path%>/board/"+url+no;
		_title.appendChild(_link);
		_title.style.textAlign = "left";
		_title.style.width = "250";
		
		var _date = document.createElement('td');
		_date.appendChild(document.createTextNode("["+date.replace(/\-/g,"\/")+"]"));
		_date.style.fontSize = "8pt";
		
		cell.appendChild(_iconImage);
		cell.appendChild(_date);
		cell.appendChild(_title);
		
		cell.style.height = "20";
		
		
		return cell;
	}

	function getNotice(){
		location.href="<%=path %>/board/noticeboard.do?method=getList&cono=2";
	}
//-->
</script>

<%@ include file="../common/include/footer.jsp" %>
